<?php
class Person{
    public $name;
    public function __construct()
    {
        echo "构造函数被调用了 <br>";
    }
    public function hello(){
        echo "大家好，我的名字是:{$this->name} <br>";
    }
    public function __destruct()
    {
        echo "析构函数被调用了 <br>";
        $this->name = null; // 清除属性值
    }
}
$student = new Person(); //实例化
$student -> name = '小明';
$student -> hello();//调用函数